package com.edu.exam.enums.grading;

/**
 * 成绩查询配置类型枚举
 */
public enum GradeQueryConfigType {
    QUERY_LIMIT("QUERY_LIMIT", "查询限制"),
    CACHE_CONFIG("CACHE_CONFIG", "缓存配置"),
    EXPORT_CONFIG("EXPORT_CONFIG", "导出配置"),
    DISPLAY_CONFIG("DISPLAY_CONFIG", "展示配置"),
    ANALYSIS_CONFIG("ANALYSIS_CONFIG", "分析配置"),
    PERMISSION_CONFIG("PERMISSION_CONFIG", "权限配置"),
    PERFORMANCE_CONFIG("PERFORMANCE_CONFIG", "性能配置"),
    SECURITY_CONFIG("SECURITY_CONFIG", "安全配置"),
    LOGGING_CONFIG("LOGGING_CONFIG", "日志配置"),
    NOTIFICATION_CONFIG("NOTIFICATION_CONFIG", "通知配置"),
    SYSTEM_CONFIG("SYSTEM_CONFIG", "系统配置"),
    BUSINESS_CONFIG("BUSINESS_CONFIG", "业务配置");

    private final String code;
    private final String description;

    GradeQueryConfigType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static GradeQueryConfigType fromCode(String code) {
        for (GradeQueryConfigType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown grade query config type code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}